home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / WWW / Perl_WWW_Utilities / total / countdown / README < prev   
Encoding:
Text File  |  1996-01-01  |  9.7 KB  |  190 lines

  1. # Countdown Script for the WWW
  2. # Written by Matt Wright
  3. # Version 1.21
  4. # Created on: 9/1/95    Last Modified on: 10/8/95
  5. # I can be reached at:          mattw@misha.net
  6. # Scripts found at:             http://www.worldwidemart.com/scripts/
  7. ##############################################################################
  8. # If you run into any problems while trying to configure this scripts, help  #
  9. # is available.  The steps you should take to get the fastest results, are:  #
  10. #       1) Read this file thoroughly                         #
  11. #       2) Consult the Matt's Script Archive Frequently Asked Questions:     #
  12. #               http://www.worldwidemart.com/scripts/faq/             #
  13. #       3) If you are still having difficulty installing this script, send   #
  14. #          e-mail to: scripts-help@tahoenet.com                     #
  15. #          Include any error messages you are receiving and as much detail   #
  16. #          as you can so we can spot your problem.  Also include the variable#
  17. #          configuration block that is located at the top of the script.     #
  18. #                                         #
  19. # Hopefully we will be able to help you solve your problems.  Thank you.     #
  20. ##############################################################################
  21.  
  22. The Countdown script is a somewhat simple script, which takes the time you give 
  23. it and tells you the number of years, months, days, hours, minutes, seconds 
  24. until that event will occur.  More details on how to use this script are below.
  25.  
  26. WHAT THIS SCRIPT CONTAINS:
  27.         This script comes with 3 different files:
  28.                 1) countdown.pl - The Perl script which does the calculation 
  29.                                   of the time until an event will occur.
  30.                 2) README - The file that does all the explaining.
  31.                 3) countdown.html - An example of ways to incorporate 
  32.                    countdown.pl and use it properly.
  33.  
  34.  
  35. You will have to do some minimal configuration of the countdown.pl file:
  36.  
  37. COUNTDOWN.PL -
  38.         The countdown.pl file is the main file in this package.  This file 
  39. needs to be placed in the server's cgi-bin or have its name changed to 
  40. countdown.cgi.  Keep in mind the latter option only works should your server 
  41. be set up to treat all .cgi files in a script manner.  If you are not sure 
  42. about this, consult your system administrator.  Inside the countdown.pl file 
  43. you can do one of two things:
  44.  
  45.         1) If you plan to just call the same date every time from this 
  46.            script, change the @from_date variable to the date you want it 
  47.            to countdown to.  This can include all the way up to seconds.  The
  48.            format for this should look like:
  49.  
  50.               @from_date = (yyyy,mm,dd,hh,mm,ss);
  51.  
  52.                 Where:
  53.                         yyyy - The Year in Four Digits.
  54.                         mm   - The first mm is the month number from 1-12.
  55.                         dd   - The Day of the month.  Values range from 1-31.
  56.                         hh   - The hour of the day.  Values range from 0-23.
  57.                         mm   - The second mm is the minute of the hour from 
  58.                                0-59.
  59.                         ss   - The ss stands for seconds and the value can 
  60.                                range from 0-59.
  61.  
  62.         2) If you plan to call different dates via a html page, you don't have 
  63.            to worry about setting any variables inside the script.
  64.  
  65. At any rate you will probably want to edit the subroutines &html_header and 
  66. &html_trailer, to customize it for your wants/needs.
  67.  
  68. ------------------------------------------------------------------------------
  69.  
  70. HOW DO I IMPLEMENT THIS?!
  71.  
  72. 1) If you have defined the @from_date in the countdown.pl file and you wish to 
  73.    only call the same value each time, you can simply do the following:
  74.  
  75.    <a href="http://your.server/cgi-bin/countdown.pl">Countdown to ...</a>
  76.  
  77.    When the user clicks on this they will be taken to a cgi generated page that
  78.    tells them the countdown status.
  79.  
  80. 2) Should you want to use this counter for various countdown you can also call 
  81.    a specific date directly from the link, in the same fashion as you would 
  82.    have defined @from_date. (See Above for info on how to define @from_date.)
  83.    Let's say I want to countdown to my birthday in 1996.  My birthday is 
  84.    April 15: 4/15, so I would do something like:
  85.  
  86.     <a href="http://my.server/cgi-bin/countdown.pl?1996,4,15,0,0,0">Countdown 
  87.     to my birthday!</a>
  88.  
  89. 3)  Allow users to countdown to their own dates!  If you want to do this you 
  90.     would use the following syntax:
  91.  
  92.     <FORM METHOD=GET ACTION="http://your.server/cgi-bin/countdown.pl">
  93.     <INPUT TYPE=TEXT NAME=""><P>
  94.     <INPUT TYPE=SUBMIT>
  95.     </FORM>
  96.  
  97.     Then when the user types in his/her query the program will generate an 
  98.     automatic response.  Make sure to let your users and yourself know that 
  99.     the format for the query must match the exact same definition as @from_date. 
  100.     (See Above for info on how to define @form_date.)
  101. -------------------------------------------------------------------------------
  102.  
  103. ADVANCED FEATURES OF COUNTDOWN!
  104.  
  105. In Some situations it may be impractical to count out to seconds.  Or maybe if 
  106. you are counting down to something closer than year, you will want to leave 
  107. out the year portion of the countdown since it is only going to be 0 all the 
  108. tie anyways.  Or maybe the same goes for month, day, etc...  Countdown has a 
  109. built in feature to allow you to do this.  Instead of defining all categories 
  110. in @from_date you can do the following:
  111.  
  112. 1) Say I want to leave out the year in the countdown to my birthday (From the 
  113.    example above.) I could also do this:
  114.  
  115.     <a href="http://my.server/cgi-bin/countdown.pl?XX,4,15,0,0,0">Countdown
  116.     to my birthday!</a>
  117.  
  118.    When the user gets the returned html document, the # of years will not be 
  119.    shown.  You can put an 'XX' in any of the fields (year, month, day, hour, 
  120.    minute, second) and it will disregard that amount of time.
  121.  
  122. 2) You can also define the same way inside of the countdown.pl.  If you are 
  123.    using a standard countdown, meaning that you see no need for  multiple 
  124.    countdowns, you can set your @from_date in your Perl script to reflect this 
  125.    (This concept is also mentioned above).  You can substitute in 'XX' for any 
  126.    amount of time you don't want. (Be it year, month, day, hour, minute, or
  127.    second)
  128.  
  129. -------------------------------------------------------------------------------
  130.  
  131. OTHER USEFUL THINGS COUNTDOWN DOES BEHIND THE SCENES:
  132.  
  133. 1) Will not return a negative value.  Often times you would see a negative 
  134.    number of hours.  Instead, when countdown comes across a negative value, it 
  135.    simply adds the correct number (12 for months, appropriate number for days, 
  136.    24 for hours, 60 for minutes and seconds).  It then subtracts one from the
  137.    next highest category so that your time comes out perfect, and all in 
  138.    positive time.  Years will appear in negative time, since if you are that 
  139.    far behind, you're messed up!  :)
  140.  
  141. 2) Calculates number of days in each month,and recognizes leap years to!
  142.  
  143. 3) Notices the difference between 1 hour and 2 hours.  So that you get proper 
  144.    English instead of 1 hours. Works the same for other units.
  145.  
  146. ------------------------------------------------------------------------------
  147.  
  148. HISTORY:
  149. Version 1.0             9/1  - Script Created.
  150. Version 1.1             9/3  - Improved the script based on suggestions by 
  151.                                Scott Lipcon:
  152.                                - Added an extra 0 to the seconds and minutes 
  153.                                  if the times were less than ten, so the 
  154.                                  clock came out looking like 5:00:00 instead
  155.                                  of 5:0:0
  156.                                - Changed the '.' in the time to a ':' between 
  157.                                  seconds and minutes so that clock looks 
  158.                                  like: '5:00:00' instead of '5:00.00'
  159.                                - Corrected the leap year system, so that it 
  160.                                  will get leap years correct.
  161.                                - Commented the file better.
  162.                              - Edited the README file slightly.
  163. Version 1.2             9/8  - Several bugs fixed based on the obersvations by 
  164.                                Elton Taupin.
  165.                                - Bug fixed that caused current date to be 
  166.                                  screwed up when the time was < 10 minutes.  
  167.                                  The problem had something to do with a 
  168.                                  misplaced colon.
  169.                                - Fixed a bug in the countdown portion of the 
  170.                                  script, which caused an extra date to be 
  171.                                  displayed on the countdown on certain 
  172.                                  instances.  It was a case of subtracting 
  173.                                  from $month, instead of $real_month.
  174. Version 1.21                   - Slight bug with 1 too many months fixed.
  175. -----------------------------------------------------------------------------
  176.  
  177. This script is provided to be useful and comes with no warranty, express or 
  178. implied.  I cannot guarantee the safety of it, yet I see no urgent problems.  
  179. I only did my best.
  180.  
  181. If you end up using this script, I would like to know where it is 
  182. implemented.  If you let me know I can add you to my list of other sites using 
  183. this script, or if you wish not to be added, I will keep your site private.  I 
  184. just want to know.  You can register this script at:
  185.         http://worldwidemart.com/scripts/implement.html
  186.  
  187. This script is provided for free, so I hope you enjoy it!
  188. ______________________________________________________________________________
  189. Matt Wright (mattw@misha.net) - http://www.worldwidemart.com/scripts/
  190.